package com.cec.home.controller

import com.cec.home.service.impl.MatchServiceImpl
import com.cec.home.utils.PKUtils
import com.mongodb.BasicDBObject
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
/**
 * Created with IDEA
 * User:hxh
 * Date:16/4/23
 * Time:上午11:34
 */
@Controller
@RequestMapping("match")
class MatchController {

    @Autowired
    MatchServiceImpl matchService

    @RequestMapping(value = "",method = RequestMethod.GET)
    def view(Model model){
        def activities = matchService.getAll([status:1] as BasicDBObject,[created:1] as BasicDBObject,null)

        def list = new ArrayList()

        activities.each {
            it.img = PKUtils.buildImg(it.img as String)

            list.add(it)
        }

        model.addAttribute("match",list)

        return "match"

    }
}
